from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

app_name = 'api'

# 创建路由器
router = DefaultRouter()
router.register(r'system/users', views.UserManagementViewSet, basename='system-users')
router.register(r'system/roles', views.RoleViewSet, basename='system-roles')
router.register(r'system/configs', views.SystemConfigViewSet, basename='system-configs')
router.register(r'system/logs', views.OperationLogViewSet, basename='system-logs')

urlpatterns = [
    # 基础接口
    path('info/', views.api_info, name='info'),
    path('hello/', views.hello, name='hello'),
    
    # 认证相关
    path('login/', views.login, name='login'),
    path('logout/', views.logout_view, name='logout'),
    path('user/info/', views.user_info, name='user_info'),
    
    # 系统设置模块（ViewSet路由）
    path('', include(router.urls)),
]

